DIY decoder building instructions
=================================

1. Cut a piece of 0.1" strip board to the required size. It will need to be at least five strips wide for the three output version or eight strips wide for the eight output version. The strip board layout diagram shows the suggested way of doing it but you may want to adapt the size of your piece of strip board to suit the location where it is being fitted. If you are using the decoder to control coach lighting it may be easier to make the strip board fit the entire size of the roof so that you can mount the illuminating LEDs on it as well as the decoder components. Strip board is often referred to as Veroboard and available in various sized sheets from electronic component suppliers.

2. Cut the tracks in the places marked on the strip board layout diagram. It is important to note that this diagram shows the topside of the board so you will need to mentally reverse the diagram while you are cutting the tracks on the bottom side. It is important to do this before you fit the components and is easy to do with a sharp 1/8" drill bit twisted between your fingers if you do not have a the proper Vero tool for the job. I have a proper Vero tool but usually just use a drill anyway because it is easy and to hand.

3. Fit the IC socket first (for the PIC IC to go in but leave the PIC out for the time being), followed by the other components working away from the IC socket, soldering them as you go. Take care not to stress the legs on the regulator which can be easily broken and take care not to overheat it or any of the other semiconductors when soldering. In order to fit the components in the minimum space some are vertically mounted and some do not have all their connections to the strip board, so fix the ends which go to the strip board first.

4. You can now test the board offline. A quick visual inspection will pick up most faults where there are solder bridges between tracks but a quick check between adjacent tracks with a buzzing continuity meter will verify that there are no big problems before connecting the power. It is especially important to check that there is no continuity between pins 1 and 3 of the regulator and it is well worth double checking that all of the diodes are the correct way round at this point as well.

5. Apply track power to the red and black wires. You should now be able to measure 5V between pins 1 and 14 of the 14-pin IC socket (or pins 1 and 8 if you have used an 8-pin). Pins 12 and 13 (or 5 and 6 on an 8-pin) should be between 0V and 5V (usually around 1V) while all of the other pins on the IC socket should be 0V, all measured relative to pin 14 (or pin 8 on an 8-pin). The common wire on the top of the vertically mounted components should be 0.65V or thereabouts. Disconnect the track power when this test is complete.

6. Program the PIC with the contents of the .HEX file which contains the firmware. If you do not have a suitable PIC programmer there are some instructions on the web available to enable you to make yourself one that can be connected to a PC parallel port, or you can buy one (best option), or you may be able to find someone that has a PIC programmer who can program the PIC for you. If you want to buy your own programmer I would recommend the Microchip PICkit2 as being both cheap and easy to use. You may need internet access to download the latest firmware in order to be able to program the PIC used in this project. When the PIC is programmed it may fail to verify because it will set up the CVs (which are held in the internal EEPROM) to factory default values while still in the programmer, so do not be too alarmed by this. 

7. You can now insert the PIC into the IC socket and connect the red and black wires to the track power. You should be able to control the outputs on loco address 3 and measure the output voltage on each of the output pins of the PIC relative to pin 14 (or pin 8 on an 8-pin ). Note that if you have an 8-pin PIC there is no output C, only A, B and D which will respond respectively to F0 forwards, F0 reverse and F2 by default.

8. You are now ready to connect the decoder to your programming track and program the CVs to your desired settings in the usual way.

